<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Single Pass Range</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Chapter 1. Range 2.0">
<link rel="up" href="../concepts.html" title="Range Concepts">
<link rel="prev" href="overview.html" title="Overview">
<link rel="next" href="forward_range.html" title="Forward Range">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="overview.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="forward_range.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="range.concepts.single_pass_range"></a><a class="link" href="single_pass_range.html" title="Single Pass Range">Single Pass Range</a>
</h3></div></div></div>
<h5>
<a name="range.concepts.single_pass_range.h0"></a>
        <span class="phrase"><a name="range.concepts.single_pass_range.notation"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.notation">Notation</a>
      </h5>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr></tr></thead>
<tbody>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">X</span></code>
                </p>
              </td>
<td>
                <p>
                  A type that is a model of <a class="link" href="single_pass_range.html" title="Single Pass Range">Single
                  Pass Range</a>.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">a</span></code>
                </p>
              </td>
<td>
                <p>
                  Object of type X.
                </p>
              </td>
</tr>
</tbody>
</table></div>
<h5>
<a name="range.concepts.single_pass_range.h1"></a>
        <span class="phrase"><a name="range.concepts.single_pass_range.description"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.description">Description</a>
      </h5>
<p>
        A range <code class="computeroutput"><span class="identifier">X</span></code> where <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">type</span></code> is a model of <a href="../../../../../../libs/iterator/doc/new-iter-concepts.html#singls-pass-iterators-lib-single-pass-iterators" target="_top">Single
        Pass Iterator</a>.
      </p>
<h5>
<a name="range.concepts.single_pass_range.h2"></a>
        <span class="phrase"><a name="range.concepts.single_pass_range.associated_types"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.associated_types">Associated
        types</a>
      </h5>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr></tr></thead>
<tbody>
<tr>
<td>
                <p>
                  Iterator type
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
                </p>
              </td>
<td>
                <p>
                  The type of iterator used to iterate through a Range's elements.
                  The iterator's value type is expected to be the Range's value type.
                  A conversion from the iterator type to the <code class="computeroutput"><span class="keyword">const</span></code>
                  iterator type must exist.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Const iterator type
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
                </p>
              </td>
<td>
                <p>
                  A type of iterator that may be used to examine, but not to modify,
                  a Range's elements.
                </p>
              </td>
</tr>
</tbody>
</table></div>
<h5>
<a name="range.concepts.single_pass_range.h3"></a>
        <span class="phrase"><a name="range.concepts.single_pass_range.valid_expressions"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.valid_expressions">Valid
        expressions</a>
      </h5>
<p>
        The following expressions must be valid.
      </p>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                <p>
                  Name
                </p>
              </th>
<th>
                <p>
                  Expression
                </p>
              </th>
<th>
                <p>
                  Return type
                </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
                <p>
                  Beginning of range
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">type</span></code> if <code class="computeroutput"><span class="identifier">a</span></code>
                  is mutable, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="keyword">const</span>
                  <span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">type</span></code> otherwise
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  End of range
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">type</span></code> if <code class="computeroutput"><span class="identifier">a</span></code>
                  is mutable, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="keyword">const</span>
                  <span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">type</span></code> otherwise
                </p>
              </td>
</tr>
</tbody>
</table></div>
<h5>
<a name="range.concepts.single_pass_range.h4"></a>
        <span class="phrase"><a name="range.concepts.single_pass_range.expression_semantics"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.expression_semantics">Expression
        semantics</a>
      </h5>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                <p>
                  Expression
                </p>
              </th>
<th>
                <p>
                  Semantics
                </p>
              </th>
<th>
                <p>
                  Postcondition
                </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  Returns an iterator pointing to the first element in the Range.
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code>
                  is either dereferenceable or past-the-end. It is past-the-end if
                  and only if <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span> <span class="special">==</span> <span class="number">0</span></code>.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  Returns an iterator pointing one past the last element in the Range.
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code>
                  is past-the-end.
                </p>
              </td>
</tr>
</tbody>
</table></div>
<h5>
<a name="range.concepts.single_pass_range.h5"></a>
        <span class="phrase"><a name="range.concepts.single_pass_range.complexity_guarantees"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.complexity_guarantees">Complexity
        guarantees</a>
      </h5>
<p>
        <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code> is at most amortized linear time, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code> is amortized
        constant time. For most practical purposes, one can expect both to be amortized
        constant time.
      </p>
<h5>
<a name="range.concepts.single_pass_range.h6"></a>
        <span class="phrase"><a name="range.concepts.single_pass_range.invariants"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.invariants">Invariants</a>
      </h5>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr></tr></thead>
<tbody>
<tr>
<td>
                <p>
                  Valid range
                </p>
              </td>
<td>
                <p>
                  For any Range <code class="computeroutput"><span class="identifier">a</span></code>,
                  <code class="computeroutput"><span class="special">[</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">a</span><span class="special">),</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span><span class="identifier">a</span><span class="special">))</span></code> is a valid range, that is, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code>
                  is reachable from <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code> in a finite number of increments.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Completeness
                </p>
              </td>
<td>
                <p>
                  An algorithm that iterates through the range <code class="computeroutput"><span class="special">[</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">a</span><span class="special">),</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span><span class="identifier">a</span><span class="special">))</span></code>
                  will pass through every element of <code class="computeroutput"><span class="identifier">a</span></code>.
                </p>
              </td>
</tr>
</tbody>
</table></div>
<h5>
<a name="range.concepts.single_pass_range.h7"></a>
        <span class="phrase"><a name="range.concepts.single_pass_range.see_also"></a></span><a class="link" href="single_pass_range.html#range.concepts.single_pass_range.see_also">See
        also</a>
      </h5>
<p>
        <a class="link" href="../reference/extending.html" title="Extending the library">Extending the library for UDTs</a>
      </p>
<p>
        <a class="link" href="../reference/concept_implementation/semantics/metafunctions.html" title="Metafunctions">Implementation
        of metafunctions</a>
      </p>
<p>
        <a class="link" href="../reference/concept_implementation/semantics/functions.html" title="Functions">Implementation
        of functions</a>
      </p>
<p>
        <a href="http://www.sgi.com/Technology/STL/Container.html" target="_top">Container</a>
      </p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003-2010 Thorsten Ottosen,
      Neil Groves<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="overview.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="forward_range.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
